import ftRequest from '../../index'
import { BASE_URL } from '@/service/request/config'
enum AnalysisAPI {
  countUp = '/statistics/countUp',
  listAllUVByFilter = '/statistics/listUVByFilter',
  listAllMUVByFilter = '/statistics/listMUVByFilter',
  downloadCSV = '/statistics/downloadUVCSV',
  downloadMCSV = '/statistics/downloadMUVCSV'
}

export function getCountUp() {
  return ftRequest.get({
    url: AnalysisAPI.countUp,
    showLoading: false
  })
}

export function getMellaUVByFilter(value: any) {
  return ftRequest.get({
    url: AnalysisAPI.listAllUVByFilter + `/${value}`,
    showLoading: false
  })
}

export function getMellaMUVByFilter(value: any) {
  return ftRequest.get({
    url: AnalysisAPI.listAllMUVByFilter + `/${value}`,
    showLoading: false
  })
}

export function downloadCSV() {
  window.open(BASE_URL + AnalysisAPI.downloadCSV)
}

export function downloadMCSV() {
  window.open(BASE_URL + AnalysisAPI.downloadMCSV)
}
